package com.kaikeba.service;

import com.kaikeba.bean.User;
import com.kaikeba.dao.imp.UserDaoMysql;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class UserService {
    static UserDaoMysql dao = new UserDaoMysql();
    /**
     * 更新登陆时间与ip
     * @param userPhone
     * @param date
     * @param ip
     */
    public static void updateLoginTimeAndIP(String userPhone, Date date, String ip){
        dao.updateLoginTime(userPhone,date,ip);
    }
    public static Map<String, Integer> console() {
        return dao.console();
    }

    public static List<User> findAll(boolean b, int offset, int pageNumber) {

        return dao.findAll(b,offset,pageNumber);
    }

    public static boolean delete(int id) {
        return dao.delete(id);
    }

    public static boolean update(int id, User newuser) {
        return dao.update(id,newuser);
    }

    public static User findByPhone(String userPhone) {
        return dao.findByPhone(userPhone);
    }

    public static boolean insert(User u) {
        return dao.insert(u);
    }
}
